﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据字典目录管理</title>
    <#--要在script前引入-->
    <#include "../common/link.ftl">
    <script>
        $(function () {
            $('.btn-input').click(function () {

                //清除模态框中表单里的旧有数据
                $('#editForm')[0].reset();
                //设置标题
                $('.modal-title').html('数据字典目录新增');

                var data = $(this).data('json');
                console.log(this);
                if(data){
                    $('.modal-title').html('数据字典目录编辑');
                    $('input[name=id]').val(data.id);
                    $('input[name=title]').val(data.title);
                    $('input[name=sn]').val(data.sn);
                    $('input[name=intro]').val(data.intro);
                }


                $('#editModal').modal('show');
            });


            $('.btn-submit').click(function () {
                $('#editForm').ajaxSubmit(function (data) {
                    if(data.success){
                        $.messager.confirm("温馨提示",data.msg,function () {
                            window.location.reload();
                        });
                    }else {
                        $.messager.alert("温馨提示",data.msg);
                    }
                });
            });


        })
    </script>


</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu = "systemDictionary">
    <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>数据字典目录管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/systemDictionary/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <a  class="btn btn-success btn-input" style="margin: 10px">
                        <span class="glyphicon glyphicon-plus"></span> 添加
                    </a>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>标题</th>
                            <th>缩写</th>
                            <th>描述</th>
                            <th>操作</th>
                        </tr>
                        <#list pageInfo.list as systemDictionary>
                            <tr>
                                <td>${systemDictionary_index+1}</td>
                                <td>${systemDictionary.title}</td>
                                <td>${systemDictionary.sn}</td>
                                <td>${systemDictionary.intro}</td>
                                <td>
                                    <a data-json='${systemDictionary.jsonData}' class="btn btn-info btn-xs btn-input">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>
                                    <@shiro.hasPermission name="systemDictionary:delete">
                                        <a data-url="/systemDictionary/delete?id=${systemDictionary.id}" class="btn btn-danger btn-xs btn-delete">
                                            <span class="glyphicon glyphicon-trash"></span> 删除
                                        </a>
                                    </@shiro.hasPermission>
                                </td>
                            </tr>
                        </#list>
                    </table>
                    <!--分页-->
                <#include "../common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>
<!---数据字典目录编辑--->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title">数据字典目录编辑</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/systemDictionary/saveOrUpdate" method="post" id="editForm">
                    <input type="hidden"  name="id">
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">标题：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="title">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">缩写：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="sn">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">描述：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="intro">
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btn-submit">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal" >取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
